#include <cstdio>
#include <vector>

/**
 * Luogu P1313: Binomial Coefficient
 */

static const int MOD = 10007;

int powi(int a, int k) {
    int result = 1;
    a %= MOD;  // necessary, otherwise a * a may overflow
    while (k != 0) {
        if (k % 2 == 1) result = (result * a) % MOD;
        a = (a * a) % MOD;
        k /= 2;
    }
    return result;
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    // Input
    int a, b, K, N, M;
    scanf("%d %d %d %d %d", &a, &b, &K, &N, &M);

    // Compute \binom{k}{n}
    // \binom{k}{n} = \binom{k-1}{n} + \binom{k-1}{n-1}
    std::vector<int> binom(K + 1, 1);
    for (int k = 2; k <= K; k++)
        for (int n = k - 1; n >= 1; n--)
            binom[n] = (binom[n] + binom[n - 1]) % MOD;

    // Compute coefficient \binom{k}{n} * a^n * b^m
    int coeff = (powi(a, N) * powi(b, M)) % MOD;
    coeff = (coeff * binom[N]) % MOD;
    printf("%d\n", coeff);

    return 0;
}
